home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2003 September / The Sunday Times - The Month 2003-09.iso / mac / The Month SEP 03 / assets / modules / print / print.swf / scripts / frame_1 / DoAction.as
Text File  |  2003-08-12  |  3KB  |  112 lines

  1. function loadImage(mc, node, extrapath)
  2. {
  3.    extrapath != null ? 0 : (extrapath = "");
  4.    var strDefaultPath = Tardis.ASSETS_FOLDER + "images/" + Tardis.ActiveSection.id + "/";
  5.    var strImg = node.getText();
  6.    var diffpath = node.attributes.path;
  7.    if(diffpath != null)
  8.    {
  9.       strImg = diffpath + strImg;
  10.    }
  11.    else
  12.    {
  13.       strImg = strDefaultPath + extrapath + strImg;
  14.    }
  15.    strPathPrefix != null ? 0 : (strPathPrefix = "");
  16.    mc.loadMovie(strPathPrefix + strImg);
  17. }
  18. function addLink(mc)
  19. {
  20.    Links[mc.link] = mc;
  21. }
  22. function getMCfromLink(Item)
  23. {
  24.    if(Links[Item] == null)
  25.    {
  26.       var arr = [];
  27.       while(Item != sideMenu.ItemHome)
  28.       {
  29.          arr.unshift(Item._name.split("_").pop());
  30.          Item = Item._parent._parent;
  31.       }
  32.       var str = arr.join("/");
  33.       Links[Item] = Links[str];
  34.    }
  35.    return Links[Item];
  36. }
  37. function init()
  38. {
  39.    var strID = Tardis.ActiveSection.id;
  40.    var Colors = Tardis.Colors;
  41.    var strColor = Colors.getString(strID);
  42.    SECTION_COLOR = Colors.getHex(strID);
  43.    SECTION_COLOR50 = Colors.getHex(strID + "50");
  44.    DEFAULT_COLOR = Colors.getHex("default");
  45.    IMAGE_PATH = nodeData.attributes.imagepath;
  46.    THUMB_PATH = nodeData.attributes.thumbpath;
  47.    var mcToDisplay = "clip" + nodeData.childNodes.length + "MC";
  48.    attachMovie(mcToDisplay,"mc_module",Tardis.depth++);
  49.    mc_module._x = 10;
  50.    mc_module._y = 10;
  51. }
  52. function txtOver(mc)
  53. {
  54.    mc.gotoAndStop("over");
  55.    Tardis.sideMenu.doOver(mc.link);
  56. }
  57. function txtOut(mc)
  58. {
  59.    mc.gotoAndStop("off");
  60.    Tardis.sideMenu.doOut(mc.link);
  61. }
  62. function txtUp(mc)
  63. {
  64.    Tardis.sideMenu.doUp(mc.link);
  65.    printImage(mc.imageToPrint);
  66. }
  67. function doOver(mc)
  68. {
  69.    mc.gotoAndStop("over");
  70. }
  71. function doOut(mc)
  72. {
  73.    mc.gotoAndStop("off");
  74. }
  75. function positionElements(mc)
  76. {
  77.    mc.activeBtn._height = mc._height;
  78.    mc.titleFF._y = mc.imgToCheck._height;
  79.    mc._visible = true;
  80.    mc.printFF._visible = true;
  81. }
  82. function printImage(strFile)
  83. {
  84.    if(System.capabilities.os.toUpperCase().indexOf("MAC OS 9") != -1)
  85.    {
  86.       lingo("Flsh_alert \"Sorry, this functionality is not available on Mac OS 9\"");
  87.       return undefined;
  88.    }
  89.    var strPath = Tardis.ASSETS_FOLDER + "images/" + Tardis.ActiveSection.id + "/" + IMAGE_PATH;
  90.    imgPrint = false;
  91.    nmWaitID = setInterval(this,"checkImage",500);
  92.    mc_image.printImageMC.loadMovie(strPath + strFile);
  93. }
  94. function checkImage()
  95. {
  96.    if(mc_image.printImageMC._height > 0 && !imgPrint)
  97.    {
  98.       imgPrint = true;
  99.       clearInterval(nmWaitID);
  100.       getURL("printasbitmap:",mc_image.printImageMC);
  101.    }
  102. }
  103. Links = {};
  104. Tardis.sideMenu.EB.addListener(this);
  105. this.onUnload = function()
  106. {
  107.    this.onUnload = null;
  108.    Tardis.sideMenu.EB.removeListener(this);
  109. };
  110. stop();
  111. onReady();
  112.